Writing an if statement inside the else block of another if statement is called an if-else-if statement or an else-if ladder.
Flowchart of Else If Ladder
Syntax of Else If Ladder
if (condition) {
...
} else if (condition) {
...
} else if (condition) {
...
} else {
...
}
Example
#include < stdio.h>
void main() {
int number = 0;
if (number > 0) {
printf("The number is positive.\n");
} else if (number < 0) {
printf("The number is negative.\n");
} else {
printf("The number is zero.\n");
}
}